package com.liyuxiang.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.liyuxiang.constants.SystemConstants;
import com.liyuxiang.pojo.entity.FriendLink;
import com.liyuxiang.pojo.vo.FriendLinkVo;
import com.liyuxiang.service.FriendLinkService;
import com.liyuxiang.mapper.FriendLinkMapper;
import com.liyuxiang.utils.BeanCopyUtils;
import com.liyuxiang.vm.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author liyuxiang
 * @description 针对表【sg_link(友链)】的数据库操作Service实现
 * @createDate 2022-03-28 21:45:55
 */
@Service
public class FriendLinkServiceImpl extends ServiceImpl<FriendLinkMapper, FriendLink>
        implements FriendLinkService {

    @Autowired
    private FriendLinkMapper friendLinkMapper;

    @Override
    public ResponseResult getAllLink() {
        List<FriendLink> friendLinkList = friendLinkMapper.selectList(new LambdaQueryWrapper<FriendLink>().eq(FriendLink::getStatus, SystemConstants.FRIEND_LINK_NORMAL));
        return new ResponseResult().ok(BeanCopyUtils.copyBeanList(friendLinkList, FriendLinkVo.class));
    }
}




